<?php


namespace app\validate\admin;


use think\Validate;

class RoleValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     * @var array
     */
    protected $rule = [
        'id' => 'require|gt:0',
        'role_name' => 'require',
        'pid' => 'require|egt:0',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     * @var array
     */
    protected $message = [
        'id.require' => '{%100101}',
        'id.gt' => '{%100101}',
        'role_name.require' => '{%100100}',
    ];

    protected $scene = [
        'add' => ['role_name'],
        'edit' => ['id', 'role_name'],
    ];
}